package chaoyue.study.component;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.stereotype.Component;

@Component
public class MyComponent {
    private Counter counter;

    public MyComponent(MeterRegistry meterRegistry) {
        this.counter = meterRegistry.counter("myComponent.doSome");
    }

    public boolean checkHealth() {
        // 这边应该自己定义一些组件是否能正常工作的检查逻辑
        return false;
    }

    public void doSome() {
        // 处理业务逻辑
        counter.increment();
    }
}
